home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat2 / standard / fork.z / fork
Encoding:
Text File  |  2002-10-03  |  9.5 KB  |  199 lines

  1.  
  2.  
  3.  
  4. ffffoooorrrrkkkk((((2222))))                                                                ffffoooorrrrkkkk((((2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ffff_oooo_rrrr_kkkk, _vvvv_ffff_oooo_rrrr_kkkk - create a new process
  10.  
  11. CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_uuuu_nnnn_iiii_ssss_tttt_dddd_...._hhhh_>>>>
  14.  
  15.      ppppiiiidddd____tttt ffffoooorrrrkkkk ((((vvvvooooiiiidddd))));;;;
  16.  
  17.      _####_iiii_ffff ______XXXX_OOOO_PPPP_EEEE_NNNN______SSSS_OOOO_UUUU_RRRR_CCCC_EEEE _&&&&_&&&& ______XXXX_OOOO_PPPP_EEEE_NNNN______SSSS_OOOO_UUUU_RRRR_CCCC_EEEE______EEEE_XXXX_TTTT_EEEE_NNNN_DDDD_EEEE_DDDD_====_====_1111
  18.      ppppiiiidddd____tttt vvvvffffoooorrrrkkkk ((((vvvvooooiiiidddd))));;;;
  19.      _####_eeee_nnnn_dddd_iiii_ffff
  20.  
  21.      Only when in the X/Open XPG4 Extended Unix name space are _vvvv_ffff_oooo_rrrr_kkkk and _ffff_oooo_rrrr_kkkk
  22.      exactly the same in this system and any reference to _ffff_oooo_rrrr_kkkk in this
  23.      document also applies to _vvvv_ffff_oooo_rrrr_kkkk.  It should also be noted that this _vvvv_ffff_oooo_rrrr_kkkk
  24.      is _NNNN_OOOO_TTTT and _DDDD_OOOO_EEEE_SSSS _NNNN_OOOO_TTTT have the same semantics as the original BSD _vvvv_ffff_oooo_rrrr_kkkk.
  25.  
  26. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  27.      _ffff_oooo_rrrr_kkkk causes creation of a new process.  The new process (child process)
  28.      is an exact copy of the calling process (parent process).  This means the
  29.      child process inherits the following attributes from the parent process:
  30.  
  31.           real user ID, real group ID, effective user ID, effective group ID
  32.           environment
  33.           close-on-exec flag [see _eeee_xxxx_eeee_cccc(2)]
  34.           signal handling settings (i.e., _SSSS_IIII_GGGG______DDDD_FFFF_LLLL, _SSSS_IIII_GGGG______IIII_GGGG_NNNN, _SSSS_IIII_GGGG______HHHH_OOOO_LLLL_DDDD, function
  35.           address)
  36.           supplementary group IDs
  37.           set-user-ID mode bit
  38.           set-group-ID mode bit
  39.           profiling on/off/mode status [see _ssss_pppp_rrrr_oooo_ffff_iiii_llll(2)]
  40.           debugger tracing status [see _pppp_rrrr_oooo_cccc(4)]
  41.           nice value [see _nnnn_iiii_cccc_eeee(2)]
  42.           scheduler class [see _pppp_rrrr_oooo_cccc(4) and _ssss_cccc_hhhh_eeee_dddd_cccc_tttt_llll(2)]
  43.           all attached shared memory segments [see _ssss_hhhh_mmmm_oooo_pppp(2)]
  44.           all mapped files [see _mmmm_mmmm_aaaa_pppp(2)]
  45.           non-degrading priority [see _ssss_cccc_hhhh_eeee_dddd_cccc_tttt_llll(2)]
  46.           process group ID
  47.           session ID [see _eeee_xxxx_iiii_tttt(2)]
  48.           current working directory
  49.           root directory
  50.           file mode creation mask [see _uuuu_mmmm_aaaa_ssss_kkkk(2)]
  51.           resource limits [see _gggg_eeee_tttt_rrrr_llll_iiii_mmmm_iiii_tttt(2)]
  52.           controlling terminal
  53.           all machine register state including floating point
  54.                control register(s)
  55.  
  56.      The child process differs from the parent process in the following ways:
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ffffoooorrrrkkkk((((2222))))                                                                ffffoooorrrrkkkk((((2222))))
  71.  
  72.  
  73.  
  74.           The child process has a unique process ID which does not match any
  75.           active process group ID.
  76.  
  77.           The child process has a different parent process ID (i.e., the
  78.           process ID of the parent process).
  79.  
  80.           The child process has its own copy of the parent's file descriptors
  81.           and directory streams.  Each of the child's file descriptors shares
  82.           a common file pointer with the corresponding file descriptor of the
  83.           parent.
  84.  
  85.           File locks previously set by the parent are not inherited by the
  86.           child [see _ffff_cccc_nnnn_tttt_llll(2)].
  87.  
  88.           All semadj values are cleared [see _ssss_eeee_mmmm_oooo_pppp(2)].
  89.  
  90.           Process locks, text locks and data locks are not inherited by the
  91.           child [see _pppp_llll_oooo_cccc_kkkk(2)].
  92.  
  93.           The set of signals pending to the parent is not inherited by the
  94.           child.
  95.  
  96.           Page locks are not inherited [see _mmmm_pppp_iiii_nnnn(2)].
  97.  
  98.           The child process's _u_t_i_m_e, _s_t_i_m_e, _c_u_t_i_m_e, and _c_s_t_i_m_e are set to 0.
  99.           The time left until an alarm clock signal is reset to 0.
  100.  
  101.           The time left until an itimer signal is reset to 0.
  102.  
  103.           The child will not inherit the ability to make graphics calls.  The
  104.           child process may receive a segmentation fault upon attempting to
  105.           make a graphics call, unless it initializes itself as a graphics
  106.           process via _wwww_iiii_nnnn_oooo_pppp_eeee_nnnn() or _gggg_iiii_nnnn_iiii_tttt().  _N_O_T_E: Currently, if the parent is
  107.           a graphics process, the child's attempt to become a graphics process
  108.           will fail.
  109.  
  110.           The share mask is set to 0 [see _ssss_pppp_rrrr_oooo_cccc(2)].
  111.  
  112.      If a _ffff_oooo_rrrr_kkkk is performed by a process that is part of a share group [see
  113.      _ssss_pppp_rrrr_oooo_cccc(2)]) then the new child process will automatically be added to the
  114.      parallel C library I/O arena.  This can result in additional ways that
  115.      _ffff_oooo_rrrr_kkkk can fail.
  116.  
  117.      _ffff_oooo_rrrr_kkkk will fail and no child process will be created if one or more of the
  118.      following are true:
  119.  
  120.  
  121.      [EAGAIN]    The system-imposed limit on the total number of processes
  122.                  under execution, {_N_P_R_O_C} [see _iiii_nnnn_tttt_rrrr_oooo(2)], would be exceeded.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ffffoooorrrrkkkk((((2222))))                                                                ffffoooorrrrkkkk((((2222))))
  137.  
  138.  
  139.  
  140.      [EAGAIN]    The system-imposed limit on the total number of processes
  141.                  under execution by a single user {_C_H_I_L_D__M_A_X} [see _iiii_nnnn_tttt_rrrr_oooo(2)],
  142.                  would be exceeded.
  143.  
  144.      [EAGAIN]    Amount of system memory required is temporarily unavailable.
  145.  
  146.      When the caller is a member of a share group in addition to the above
  147.      errors _ffff_oooo_rrrr_kkkk will fail and no new process will be created if one or more
  148.      of the following are true:
  149.  
  150.      [ENOSPC]    If the total number of share group members plus children
  151.                  exceeds the maximum number of users specified via
  152.                  _uuuu_ssss_cccc_oooo_nnnn_ffff_iiii_gggg(3P) (8 by default).  Any changes via _uuuu_ssss_cccc_oooo_nnnn_ffff_iiii_gggg(3P)
  153.                  must be done BEFORE the first _ssss_pppp_rrrr_oooo_cccc is performed.
  154.  
  155.      [ENOLCK]    There are not enough file locks in the system.
  156.  
  157.      _N_e_w _p_r_o_c_e_s_s _p_i_d # _c_o_u_l_d _n_o_t _j_o_i_n _I/_O _a_r_e_n_a:<..>
  158.                  if the new process could not properly join the parallel C
  159.                  library I/O arena.  The new process in this case exits with a
  160.                  -1.
  161.  
  162. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  163.      exec(2), intro(2), mmap(2), nice(2), plock(2), ptrace(2), schedctl(2),
  164.      semop(2), shmop(2), signal(2), sigset(2), sigaction(2), schedctl(2),
  165.      sproc(2), sprofil(2), times(2), ulimit(2), umask(2), wait(2),
  166.      pcreate(3C), signal(3B), sigvec(3B), usinit(3P), usconfig(3P), proc(4).
  167.  
  168. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  169.      Upon successful completion, _ffff_oooo_rrrr_kkkk returns a value of _0000 to the child
  170.      process and returns the process ID of the child process to the parent
  171.      process.  Otherwise, a value of (_p_i_d__t)-_1 is returned to the parent
  172.      process, no child process is created, and _eeee_rrrr_rrrr_nnnn_oooo is set to indicate the
  173.      error.
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.